package opera;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class FindOperation  implements IOPeration{
    @Override
    public void work(BookList bookList) {
        int currenSize = bookList.getUsedSize();
        System.out.println("请输入要查找书的名字");
        Scanner sc = new Scanner(System.in);
        String input = sc.nextLine();
        for(int i = 0;i < currenSize;i++) {
            Book book = bookList.getBooK(i);
            if(book.getName().equals(input)){
                System.out.println(book);
                return;
            }
        }
        System.out.println("查找书不存在");
    }

}
